<template>
    <div>
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>
                    <i class="el-icon-lx-cascades"></i> 面试管理
                </el-breadcrumb-item>    
                <el-breadcrumb-item>添加面试记录</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <div class="form-box">
                <el-form ref="form" :model="form" label-width="80px">
                    <el-form-item label="应聘者Id">
                        <el-input v-model="form.canId"></el-input>
                    </el-form-item>
                    <el-form-item label="人力资源Id">
                        <el-input v-model="form.hrId"></el-input>
                    </el-form-item>
                    <el-form-item label="面试评价">
                        <el-cascader :options="options1" v-model="form.interDetail"></el-cascader>
                    </el-form-item>
                    <el-form-item label="面试记录Id">
                        <el-input v-model="form.interId"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSubmit">提交</el-button>
                        <el-button>取消</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'addi',
    data() {
        return {
            options1: [
                    {
                        value:1,
                        label:"优秀"
                    },
                    {
                        value:2,
                        label:"良好"
                    },
                    {
                        value:3,
                        label:"一般"
                    },
                    {
                        value:4,
                        label:"合格"
                    },
                    {
                        value:5,
                        label:"不合格"
                    }
            ],
            options2: [
                {
                    value:1,
                    label:"技术部"
                },
                {
                    value:2,
                    label:"推广部"
                },
                {
                    value:3,
                    label:"客服部"
                },
                {
                    value:4,
                    label:"行政部"
                },
                {
                    value:5,
                    label:"财务部"
                }
            ],
            options3: [
                {
                    value:"架构师",
                    label:"架构师"
                },
                {
                    value:"web前端工程师",
                    label:"web前端工程师"
                },
                {
                    value:"运维工程师",
                    label:"运维工程师"
                },
                {
                    value:"后端开发工程师",
                    label:"后端开发工程师"
                },
                {
                    value:"测试开发工程师",
                    label:"测试开发工程师"
                }
            ],
            options4:[
                {
                    value:"高中",
                    label:"高中"
                },
                {
                    value:"大专",
                    label:"大专"
                },
                {
                    value:"本科",
                    label:"本科"
                },
                {
                    value:"硕士",
                    label:"硕士"
                },
                {
                    value:"博士",
                    label:"博士"
                }
            ],
            form: {
                canId: '',
                hrId: '',
                interDetail: '',
                interId: '',
            }
        };
    },
    methods: {
        onSubmit() {
            const _this=this;
            _this.form.canId = parseInt(_this.form.canId);
            _this.form.hrId = parseInt(_this.form.hrId);
            _this.form.interDetail = parseInt(_this.form.interDetail[0]);
            _this.form.interId = parseInt(_this.form.interId);
             this.$axios
                .post('/Interview/addInterview',_this.form, {
                    headers: {
                        Authorization: localStorage.getItem('token')
                    }
                })
                .then(res => {
                    console.log(res)
                    if (res.data.code == 200) {
                        this.$message.success(res.data.msg);
                        _this.form.canId = '';
                        _this.form.hrId = '';
                        _this.form.inteDetail = '';
                        _this.form.interId = '';
                    } else {
                        this.$message.error(res.data.msg);
                    }
                });
        }
    }
};
</script>